package com.bes.sdk.message;

import static com.bes.sdk.message.Constants.FIRST_GET_SETTINGS_JSON_FILE_SUCCESS;
import static java.lang.Math.min;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
import android.util.Log;
import com.bes.bessdk.utils.ArrayUtil;
import com.bes.bessdk.utils.SPHelper;
import com.bes.event.ProgressEvent;
import com.bes.sdk.utils.SettingsJsonUtils;
import com.blankj.utilcode.util.SDCardUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import org.greenrobot.eventbus.EventBus;

/**
 * Kit@BB
 * An analyzer which can analyze string info from the message content
 */
public class MsgStrAnalyzer {
	public static final String SCHEME_APP_LANXING = "lanxing";
	public static String mMacAddress = "00:00:00:00:00:00";
	private static final String TAG = "MsgStrAnalyzer";
	public static long currentAllFileLength = 0;
	public static CmdPackageHeader dph;
	public static byte[] msgContentSavingByte;
	public static int savedLength;
	public static byte[] msgId;
	public static int msgCallBackId; // this is for call back check id. wangsm

	public static String filePath; // this is for call back file name. wangsm
	private static String mPath = Environment.getExternalStorageDirectory() + "/";
	public String[] msgStr;

	public MsgStrAnalyzer() {
	}

	public MsgStrAnalyzer(Object msgContent) {
		byte[] msgContByte = (byte[]) msgContent;
		if (msgContByte == null || msgContByte.length == 0) {
			Log.i(TAG, "MsgStrAnalyzer(Str): ----- Invalid message content");
			return;
		}
	}

	public static void setMsgCallBackId(int msgId, String fileAbsPath) {
		msgCallBackId = msgId;
		filePath = fileAbsPath;
	}

	public static CmdPackageHeader getMsgCmdPackageHeader() {
		return dph;
	}

	public static int getMsgCallBackId() {
		return msgCallBackId;
	}

	public static void setMsgCallBackId(int msgId) {
		msgCallBackId = msgId;
	}

	public static String getFilePath() {
		return filePath;
	}

	public static boolean isExistFilePath() {
		return filePath != null && !filePath.isEmpty();
	}

	public static void saveCurrentPackageCMD(Context context, String currentPackageCMD) {
		if (context == null) {
			return;
		}
		android.util.Log.i(TAG, "saveCurrentPackageCMD: " + currentPackageCMD);
		SharedPreferences deviceInfoPrefernce = context.getSharedPreferences("pkg_info", Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = deviceInfoPrefernce.edit();
		editor.putString("pkg_currentPackageCmd", currentPackageCMD);
		editor.commit();
	}

	public static void saveCurrentPackageIndex(Context context, int currentPackageIndex) {
		if (context == null) {
			return;
		}
		android.util.Log.i(TAG, "currentPackageIndex: " + currentPackageIndex);
		SharedPreferences deviceInfoPrefernce = context.getSharedPreferences("pkg_info", Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = deviceInfoPrefernce.edit();
		editor.putInt("pkg_currentPackageIndex", currentPackageIndex);
		editor.commit();
	}

	public static void saveCurrentTrkPackageIndex(Context context, long currentPackageTrkIndex) {
		//if (context == null) {
		//    return;
		//}
		//android.util.Log.i(TAG, "currentPackageTrkIndex: " + currentPackageTrkIndex);
		//SharedPreferences deviceInfoPrefernce = context.getSharedPreferences("pkg_info", Context.MODE_PRIVATE);
		//SharedPreferences.Editor editor = deviceInfoPrefernce.edit();
		//editor.putLong("currentPackageTrkIndex", currentPackageTrkIndex);
		//editor.commit();
		EventBus.getDefault().post(new ProgressEvent(currentPackageTrkIndex));
	}

	public static boolean startSaveFile(byte[] msgContByte, Context context, String device_model, String sn, String filename) {
		boolean bResult = false;
		File files = context.getExternalFilesDir("");
		String fileDir = files.getAbsolutePath() + File.separator + SCHEME_APP_LANXING + File.separator + device_model + File.separator + sn + File.separator;
		if (msgContByte == null || msgContByte.length < Constants.CMD_HEADER_LEN) {
			Log.i(TAG, "startSaveFile(Str): ----- Invalid data");
			return false;
		}

		if (msgContByte[0] == Constants.GENERAL_PROTOCOL_MULTI_PKG_SIGN && msgContByte.length >= 5) {
			Log.i(TAG, "startSaveFile(Str): ----- multi package fileDir = " + fileDir + ",filename = " + filename);
			return saveMultiPackage(msgContByte, context, fileDir, filename);
		}

		byte[] msgContentHeader = new byte[Constants.CMD_HEADER_LEN];
		byte[] msgContentBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
		System.arraycopy(msgContByte, 0, msgContentHeader, 0, Constants.CMD_HEADER_LEN);
		setMsgId(msgContentHeader);
		System.arraycopy(msgContByte, 4, msgContentBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);

		if (isSameCmd(Constants.CMD_AW_8DC5, msgContentHeader) && msgContByte.length > 7) {// routebooks.json
			byte[] msgRouteBooksBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgRouteBooksBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.ROUTE_BOOKS_FOLDER + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DC5 filePath===" + filePath);

			bResult = writeTOFileNew(msgRouteBooksBody, filePath, SettingsJsonUtils.ROUTE_BOOKS_JSON, "", true);
			if (bResult) {
				setMsgCallBackId(Constants.SAVE_ROUTE_JSON_FILE_SUCCESS);// add by wangsm
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB7, msgContentHeader)) { // user_profile.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DB7 filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.USERPROFILE_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			if (bResult) {
				Log.d(TAG, " user_profile.json success,set msg id panels json file sucess.");
				setMsgCallBackId(Constants.SAVE_USER_PROFILE_JSON_FILE_SUCCESS);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB8, msgContentHeader)) { // gear_profile.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DB8 filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.GEAR_PROFILE_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB9, msgContentHeader)) { // settings.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			int msgId = getMsgCallBackId();
			if (msgId == FIRST_GET_SETTINGS_JSON_FILE_SUCCESS) {
				fileDir = context.getExternalFilesDir("").getAbsolutePath() + File.separator + SCHEME_APP_LANXING + File.separator + SettingsJsonUtils.DEVICE_MODEL_DEFAULT + File.separator + SettingsJsonUtils.DEVICE_SN_DEFAULT + File.separator;
			}
			String filePath = fileDir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DB9 filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.SETTING_JSON, "", true);
			if (bResult) {
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DCA, msgContentHeader)) { // settings.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DCA filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.SETTING_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DCB, msgContentHeader)) { // settings.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_END_LEN - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_END_LEN - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DCB filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.SETTING_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB0, msgContentHeader)) { // track summary:workouts.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.WORKOUTS_FOLDER + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DB0 filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.WORKOUT_JSON, "", true);
			if (bResult) {
				setMsgCallBackId(Constants.SAVE_WORKOUT_LIST_FILE_SUCCESS);// add by wangsm
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB2, msgContentHeader)) { // track detail: xxx.trk
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.WORKOUTS_FOLDER + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DB2 filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, filename, "", true);
			Log.d(TAG, " save TRK file===" + filename + " is " + bResult + ",success");
			if (bResult) {
				String fileAbsolutePath = filePath + filename;
				setMsgCallBackId(Constants.SAVE_WORKOUT_TRK_FILE_SUCCESS, fileAbsolutePath);// add by wangsm
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB4, msgContentHeader)) { // panels.json
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DB4 filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.PANEL_JSON, "", true);
			Log.d(TAG, " save panels file===" + filename + " is " + bResult + ",success");
			if (bResult) {
				Log.d(TAG, " write panels.json success,set msg id panels json file sucess.");
				setMsgCallBackId(Constants.SAVE_PANELS_JSON_FILE_SUCCESS);// add by wangsm panels.json
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DDD, msgContentHeader)) { // upload_log_file_list.txt
			byte[] msgBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
			System.arraycopy(msgContentBody, 0, msgBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
			String filePath = fileDir + SettingsJsonUtils.DEVICE_LOG + File.separator;
			Log.i(TAG, "startSaveFile(Str): ----- single package CMD_AW_8DDD filePath===" + filePath);

			bResult = writeTOFileNew(msgBody, filePath, SettingsJsonUtils.BB_OFFLINE_LOG_JSON, "", true);
			Log.d(TAG, " save upload_log_file_list.txt file===" + filename + " is " + bResult + ",success");
			if (bResult) {
				Log.d(TAG, " write upload_log_file_list.txt success,set msg id upload_log_file_list txt file sucess.");
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		}
		String[] result = startAnalyze(msgContByte, context, device_model, sn, filename);
		if (null != result) {
			if (result.length == 1) {
				return result[0].equals("1");
			}
		}
		return bResult;
	}

	public static boolean saveFileToLanXingPath(byte[] mDataSaveByteFinal, Context context, String dir, String filename) {
		boolean bResult = false;
		if (isSameCmd(Constants.CMD_AW_8DB0, dph.cmdId)) { // track summary workouts.json
			Log.i(TAG, "8D B0");
			String filePath = dir + SettingsJsonUtils.WORKOUTS_FOLDER + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.WORKOUT_JSON, "", true);
			if (bResult) {
				Log.d(TAG, " save workouts.json file ok,set msg id");
				setMsgCallBackId(Constants.SAVE_WORKOUT_LIST_FILE_SUCCESS);// add by wangsm
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB1, dph.cmdId)) {
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB2, dph.cmdId)) { // track detail xxx.trk
			String filePath = dir + SettingsJsonUtils.WORKOUTS_FOLDER + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, filename, "", true);
			Log.d(TAG, " 226 ,save TRK file===" + filename + " is " + bResult + ",success");
			if (bResult) {
				String fileAbsolutePath = filePath + filename;
				setMsgCallBackId(Constants.SAVE_WORKOUT_TRK_FILE_SUCCESS, fileAbsolutePath);// add by wangsm
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB4, dph.cmdId)) { // panels.json
			String filePath = dir + SettingsJsonUtils.SETTINGS + File.separator;
			Log.i(TAG, "saveMultiPackage(Str): ----- multi package CMD_AW_8DB4 filePath===" + filePath);
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.PANEL_JSON, "", true);
			if (bResult) {
				Log.d(TAG, " write panels.json success,set msg id panels json file sucess.");
				setMsgCallBackId(Constants.SAVE_PANELS_JSON_FILE_SUCCESS);// add by wangsm panels.json
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB7, dph.cmdId)) { // user_profile.json
			String filePath = dir + SettingsJsonUtils.SETTINGS + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.USERPROFILE_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			if (bResult) {
				Log.d(TAG, " user_profile.json success,set msg id panels json file sucess.");
				setMsgCallBackId(Constants.SAVE_USER_PROFILE_JSON_FILE_SUCCESS);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB8, dph.cmdId)) { // gear.json
			String filePath = dir + SettingsJsonUtils.SETTINGS + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.GEAR_PROFILE_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DB9, dph.cmdId)) { // settings.json
			int msgId = getMsgCallBackId();
			if (msgId == FIRST_GET_SETTINGS_JSON_FILE_SUCCESS) {
				dir = context.getExternalFilesDir("").getAbsolutePath() + File.separator + SCHEME_APP_LANXING + File.separator + SettingsJsonUtils.DEVICE_MODEL_DEFAULT + File.separator + SettingsJsonUtils.DEVICE_SN_DEFAULT + File.separator;
			}
			String filePath = dir + SettingsJsonUtils.SETTINGS + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.SETTING_JSON, "", true);
			Log.d(TAG, " save settings.json ,set call back id settings json, bResult : " + bResult);
			if (bResult) {
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DC5, dph.cmdId)) { // routebooks.json
			String filePath = dir + SettingsJsonUtils.ROUTE_BOOKS_FOLDER + File.separator;
			Log.i(TAG, "saveMultiPackage(Str): ----- multi package CMD_AW_8DC5 filePath===" + filePath);
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.ROUTE_BOOKS_JSON, "", true);
			if (bResult) {
				setMsgCallBackId(Constants.SAVE_ROUTE_JSON_FILE_SUCCESS);// add by wangsm
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DCA, dph.cmdId)) { // settings.json
			String filePath = dir + SettingsJsonUtils.SETTINGS + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.SETTING_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DCB, dph.cmdId)) { // settings.json
			String filePath = dir + SettingsJsonUtils.SETTINGS + File.separator;
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.SETTING_JSON, "", true);
			saveCurrentPackageCMD(context, "00");
			saveCurrentPackageIndex(context, 0);
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DDD, dph.cmdId)) { // upload_log_file_list.txt
			String filePath = dir + SettingsJsonUtils.DEVICE_LOG + File.separator;
			Log.i(TAG, "saveMultiPackage(Str): ----- multi package CMD_AW_8DDD filePath===" + filePath);
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, SettingsJsonUtils.BB_OFFLINE_LOG_JSON, "", true);
			if (bResult) {
				String fileAbsolutePath = filePath + SettingsJsonUtils.BB_OFFLINE_LOG_JSON;
				setMsgCallBackId(Constants.DEVICE_LOG_JSON_FILE_SUCCESS, fileAbsolutePath);
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		} else if (isSameCmd(Constants.CMD_AW_8DDB, dph.cmdId)) { // bb offline log xxx.log
			String filePath = dir + SettingsJsonUtils.DEVICE_LOG + File.separator;
			filename = filename.substring(filename.lastIndexOf(File.separatorChar) + 1);
			bResult = writeTOFileNew(mDataSaveByteFinal, filePath, filename, "", true);
			Log.d(TAG, " CMD_AW_8DDB ,save Log file===" + filename + " is " + bResult + ",success");
			if (bResult) {
				saveCurrentPackageCMD(context, "00");
				saveCurrentPackageIndex(context, 0);
			}
			return bResult;
		}
		return bResult;
	}

	public static boolean saveMultiPackage(byte[] msgContentByte, Context mContext, String dir, String filename) {
		boolean bResult = false;
		int index = byteToBigInteger(msgContentByte, Constants.MULTI_PACKAGE_INDEX_START, Constants.MULTI_PACKAGE_PACK_NUM_START);
		Log.i(TAG, "saveMultiPackage ---index=" + index + " currentAllFileLength=" + currentAllFileLength);
		saveCurrentTrkPackageIndex(mContext, (currentAllFileLength + index) * (Constants.GENERAL_PROTOCOL_PKG_MAX_LEN));
		// first package,parse multi package header
		if (index == 0) {
			Log.i(TAG, "saveMultiPackage ---parse multi package header");
			byte[] packageHeader = new byte[Constants.MULTI_FIRST_PACKAGE_HEADER_LEN];
			System.arraycopy(msgContentByte, 0, packageHeader, 0, Constants.MULTI_FIRST_PACKAGE_HEADER_LEN);
			dph = parseMultiPackageHeader(packageHeader);
			setMsgId(dph.cmdId);
			if (dph.packageTotalNum > (65535 / Constants.GENERAL_PROTOCOL_PKG_MAX_LEN)) { // 0xFFFF
				dph.packagelength = dph.packageTotalNum * (Constants.GENERAL_PROTOCOL_PKG_MAX_LEN);
			}
			msgContentSavingByte = new byte[dph.packagelength];
			System.arraycopy(msgContentByte, Constants.MULTI_FIRST_PACKAGE_HEADER_LEN, msgContentSavingByte, 0, msgContentByte.length - Constants.MULTI_FIRST_PACKAGE_HEADER_LEN);
			savedLength = msgContentByte.length - Constants.MULTI_FIRST_PACKAGE_HEADER_LEN;
			Log.i(TAG, "saveMultiPackage ---receive data =" + savedLength);
			if (index == dph.packageTotalNum - 1) {
				byte[] mDataSaveByteFinal = new byte[savedLength];
				System.arraycopy(msgContentSavingByte, 0, mDataSaveByteFinal, 0, savedLength);
				bResult = saveFileToLanXingPath(mDataSaveByteFinal, mContext, dir, filename);
			}
		} else {
			if (dph != null) {
				if (index <= dph.packageTotalNum - 1) {
					System.arraycopy(msgContentByte, Constants.MULTI_OTHERS_PACKAGE_HEADER_LEN, msgContentSavingByte, savedLength, msgContentByte.length - Constants.MULTI_OTHERS_PACKAGE_HEADER_LEN);
					savedLength = savedLength + msgContentByte.length - Constants.MULTI_OTHERS_PACKAGE_HEADER_LEN;
					Log.i(TAG, "saveMultiPackage ---receive data savedLength =" + savedLength + " packageTotalNum=" + dph.packageTotalNum);
					if (index == dph.packageTotalNum - 1) {
						byte[] mDataSaveByteFinal = new byte[savedLength];
						System.arraycopy(msgContentSavingByte, 0, mDataSaveByteFinal, 0, savedLength);
						bResult = saveFileToLanXingPath(mDataSaveByteFinal, mContext, dir, filename);
						currentAllFileLength += index;
					}
				}
			} else {
				Log.i(TAG, "dph is null,package header fail");
			}
		}
		return bResult;
	}

	public static String[] startAnalyze(byte[] msgContByte, Context mContext, String device_model, String sn, String filename) {
		/**
		 File files = mContext.getExternalFilesDir("");
		 String fileDir = "";
		 fileDir = files.getAbsolutePath() + File.separator + device_model + File.separator + sn + File.separator;
		 if (msgContByte == null || msgContByte.length < Constants.CMD_HEADER_LEN) {
		 Log.i(TAG, "startAnalyze(Str): ----- Invalid data");
		 return null;
		 }

		 if (msgContByte[0] == Constants.GENERAL_PROTOCOL_MULTI_PKG_SIGN) {
		 Log.i(TAG, "startAnalyze(Str): ----- multi package fileDir===" + fileDir);
		 return parseMultiPackage(msgContByte, fileDir, filename);
		 }**/

		byte[] msgContentHeader = new byte[Constants.CMD_HEADER_LEN];
		byte[] msgContentBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
		System.arraycopy(msgContByte, 0, msgContentHeader, 0, Constants.CMD_HEADER_LEN);
		setMsgId(msgContentHeader);
		System.arraycopy(msgContByte, 4, msgContentBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);

		if (isSameCmd(Constants.CMD_AW_80011400, msgContentHeader)) {
			return getPersonalInfo(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80060E00, msgContentHeader)) {
			return getDeviceTime(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80080500, msgContentHeader)) {
			return getBatteryLevel(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_800A0500, msgContentHeader)) {
			return getDeviceWornStatus(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_800B0500, msgContentHeader)) {
			return getDeviceChargeStatus(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_800D0900, msgContentHeader)) {
			return getLiftWristToViewSetting(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_800E, msgContentHeader)) {
			return getSerialNumber(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80200500, msgContentHeader)) {
			return getTempParams(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80220500, msgContentHeader)) {
			return getDistanceUnit(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80230A00, msgContentHeader)) {
			return getMacAddress(mContext,msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80240C00, msgContentHeader)) {
			return getFirmwareVersion(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80250500, msgContentHeader)) {
			return getAutomaticHeartRateInterval(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80270500, msgContentHeader)) {
			return getSoundVolume(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8028, msgContentHeader)) {
			return getPhoneBook(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80290900, msgContentHeader)) {
			return getWatchSize(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80810500, msgContentHeader)) {
			return setPersonalInfo(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80820500, msgContentHeader)) {
			return setTimeFormat(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80860500, msgContentHeader)) {
			return setDeviceMode(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80850500, msgContentHeader)) {
			return setParingPhoneType(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80870500, msgContentHeader)) {
			return setDeviceTime(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80890500, msgContentHeader)) {
			return setTimeZone(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_808C0500, msgContentHeader)) {
			return setHandPreference(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_808B0500, msgContentHeader)) {
			return setHandShowScreen(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_808D0500, msgContentHeader)) {
			return setWristToView(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_808F0500, msgContentHeader)) {
			return setSN(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80910500, msgContentHeader)) {
			return setPairingState(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80A20500, msgContentHeader)) {
			return setDistanceDisplayUnit(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80A70500, msgContentHeader)) {
			return setSoundVolume(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80A80500, msgContentHeader)) {
			return setPhoneBook(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_80A90600, msgContentHeader)) {
			byte[] msgWeatherControlBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgWeatherControlBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);

			return configWeatherControlInfo(msgWeatherControlBody);
		} else if (isSameCmd(Constants.CMD_AW_80AA, msgContentHeader)) {
			byte[] msgBtBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgBtBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);

			return switchAndGetBroadcastNameAndMacAddressOfBt(msgBtBody);
		} else if (isSameCmd(Constants.CMD_AW_80AB0600, msgContentHeader)) {
			byte[] msgBindBtBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgBindBtBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);

			return unBindBT(msgBindBtBody);
		} else if (isSameCmd(Constants.CMD_AW_80AC0600, msgContentHeader)) {
			byte[] msgCallAlarmBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgCallAlarmBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);

			return setCallAlarm(msgCallAlarmBody);
		} else if (isSameCmd(Constants.CMD_AW_81AF0500, msgContentHeader)) {
			return setScreenBrightness(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81000900, msgContentHeader)) {
			return getHistoryStepData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8102, msgContentHeader)) {
			// Special instructions: FIT_GET_AUTO_ECG_DATA
			byte[] msgECGContentBody = new byte[msgContByte.length - Constants.CMD_ECG_HEADER_LEN];
			System.arraycopy(msgContByte, 2, msgECGContentBody, 0, msgContByte.length - Constants.CMD_ECG_HEADER_LEN);
			return geAutoECGData(msgECGContentBody); // FIT_GET_AUTO_ECG_DATA
		} else if (isSameCmd(Constants.CMD_AW_8105, msgContentHeader)) {
			// Special instructions：FIT_GET_HISTORY_TEMP
			return getHistoryTempData(msgContentBody); // FIT_GET_HISTORY_TEMP
		} else if (isSameCmd(Constants.CMD_AW_8106, msgContentHeader)) {
			// Special instructions： FIT_GET_5_MINUTES_WALK
			return getFiveMinutesWalk(msgContentBody); // FIT_GET_5_MINUTES_WALK
		} else if (isSameCmd(Constants.CMD_AW_810A0A00, msgContentHeader)) {
			return getLatestHealthData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_810C, msgContentHeader)) {
			// Special instructions： FIT_GET_1_MINUTES_SLEEP
			return getOneMinutesSleep(msgContentBody); // FIT_GET_1_MINUTES_SLEEP
		} else if (isSameCmd(Constants.CMD_AW_810D, msgContentHeader)) {
			// Special instructions： FIT_GET_5_MINUTES_RUNNING
			return getFiveMinutesRunning(msgContentBody); // FIT_GET_5_MINUTES_RUNNING
		} else if (isSameCmd(Constants.CMD_AW_8120, msgContentHeader)) {// FIT_GET_SEDENTARY_ALART
			// Special instructions：FIT_GET_SEDENTARY_ALART
			return getSedentaryData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8123, msgContentHeader)) {// FIT_GET_ACTIVITY_CONFIG_SUMMARY
			// Special instructions：FIT_GET_ACTIVITY_CONFIG_SUMMARY
			// byte[] activityConfigSummaryValue = new byte[msgContentSavingByte.length - 1];
			// System.arraycopy(msgContentSavingByte, 1, activityConfigSummaryValue, 0, msgContentSavingByte.length -
			// 1);
			int number = HexToDecimal(msgContentBody[0]);
			return getActivityConfigSummary(msgContentBody, number);
		} else if (isSameCmd(Constants.CMD_AW_81250A00, msgContentHeader)) {
			return getSPO2Para(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8126, msgContentHeader)) {
			return getSPO2Data(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81280600, msgContentHeader)) {
			return getSleepTargetValue(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81291200, msgContentHeader)) {
			return getSleepSummaryData(msgContentBody);
		}
		// CMD_AW_812D1E00 and CMD_AW_812D6600 calls getHistoryDistanceData
		else if (isSameCmd(Constants.CMD_AW_812D1E00, msgContentHeader) || isSameCmd(Constants.CMD_AW_812D6600, msgContentHeader)) {
			return getHistoryDistanceData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_812E1E00, msgContentHeader) || isSameCmd(Constants.CMD_AW_812E6600, msgContentHeader)) {
			return getHistoryCaloryData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_812F1000, msgContentHeader)) {
			return getTodayFitnessData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81800500, msgContentHeader)) {
			return setDailyWalking(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81830500, msgContentHeader)) {
			return setAutoHRInterval(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81850500, msgContentHeader)) {
			return setHRLiveControl(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81860500, msgContentHeader)) {
			return setSPO2LiveControl(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81890500, msgContentHeader)) {
			return setEraseFitnessData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_818B0500, msgContentHeader)) {
			return setSportMode(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81910500, msgContentHeader)) {
			return setUpdateVO2MaxValue(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81920500, msgContentHeader)) {
			return setUpdateHRZoneValue(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81930500, msgContentHeader)) {
			return setLiveStepsControl(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81960500, msgContentHeader)) {
			return setGpsControl(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81970500, msgContentHeader)) {
			return setSportModePause(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_819E0500, msgContentHeader)) {
			return setAutoPPGInterval(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81AC0900, msgContentHeader)) {
			return getFirmwareCapbility(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81A30500, msgContentHeader) || isSameCmd(Constants.CMD_AW_81A50500, msgContentHeader)) {
			return setSPO2Para(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81A80500, msgContentHeader)) {
			return setSleepTargetValue(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_81A90600, msgContentHeader)) {
			byte[] msgStressParaBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgStressParaBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return setStressPara(msgStressParaBody);
		} else if (isSameCmd(Constants.CMD_AW_81AA, msgContentHeader)) {
			byte[] msgStressHistoryBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgStressHistoryBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return getStressHistoryData(msgStressHistoryBody);
		} else if (isSameCmd(Constants.CMD_AW_81AB0600, msgContentHeader)) {
			byte[] msgSetMotionRegBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgSetMotionRegBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return setMotionRecognition(msgSetMotionRegBody);
		} else if (isSameCmd(Constants.CMD_AW_81AB0D00, msgContentHeader)) {
			byte[] msgGetMotionRegBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgGetMotionRegBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return getMotionRecognition(msgGetMotionRegBody);
		} else if (isSameCmd(Constants.CMD_AW_8205, msgContentHeader)) {
			return getAlarmConfig(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82090B00, msgContentHeader)) {
			return getNoDisturbMode(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_820D, msgContentHeader)) {
			return getDialList(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_820F0600, msgContentHeader)) {
			return getCurrentDial(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82100500, msgContentHeader)) {
			return getCompetitionInfoControl(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82120500, msgContentHeader)) {
			return getDeviceControlFun(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8213, msgContentHeader)) {
			return getPicList(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8216, msgContentHeader)) {
			return getDialBackgroundPic(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_8217, msgContentHeader)) {
			return getQuickMsgList(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82181300, msgContentHeader)) {
			return getFemaleHealthPara(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82800500, msgContentHeader)) {
			return setSedentaryAlartPara(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82810500, msgContentHeader)) {
			return setMusicNoticeSwitch(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82820500, msgContentHeader)) {
			return setMsgNodifySwitch(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82830500, msgContentHeader)) {
			return sendMsgNotifyContent(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82850500, msgContentHeader)) {
			return setAlarm(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82890500, msgContentHeader)) {
			return setDndMode(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_828A0500, msgContentHeader)) {
			return sendSingerName(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_828B0500, msgContentHeader)) {
			return sendMusicName(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_828E0500, msgContentHeader)) {
			return sendDialData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_828F0500, msgContentHeader)) {
			return setCurrentDial(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82900500, msgContentHeader)) {
			return deleteDial(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82910500, msgContentHeader)) {
			return setCompetitionInfoSwitch(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82920500, msgContentHeader)) {
			return syncCompetitionInfo(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82930500, msgContentHeader)) {
			return syncWeatherInfo(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82940500, msgContentHeader)) {
			return sendPicData(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82950500, msgContentHeader)) {
			return delPic(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82960500, msgContentHeader)) {
			return setDialBackgroundPic(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82970500, msgContentHeader)) {
			return setQuickMsgList(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82980500, msgContentHeader)) {
			return setFemaleHealthPara(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_82990500, msgContentHeader)) {
			return customizeMsg(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_829A0500, msgContentHeader)) {
			return customizeReminder(msgContentBody); // ????
		} else if (isSameCmd(Constants.CMD_AW_82A10500, msgContentHeader)) {
			return searchWatch(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_84000500, msgContentHeader)) {
			return getVibratorLevel(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_84800500, msgContentHeader)) {
			return setVibratorLevel(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_86060500, msgContentHeader)) {
			return getScreenOnTime(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_86070600, msgContentHeader)) {
			byte[] msgUserSelfExamModeBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgUserSelfExamModeBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);

			return userSelfExamModeSwitch(msgUserSelfExamModeBody);
		}
		// else if(isSameCmd(Constants.CMD_AW_82920500, msgContentHeader)) {
		// return userSelfExamModeTest(msgContentBody);
		// }
		else if (isSameCmd(Constants.CMD_AW_86810500, msgContentHeader)) {
			return resetDevice(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_86820500, msgContentHeader)) {
			return closeDevice(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_86860500, msgContentHeader)) {
			return setScreenOnTime(msgContentBody);
		} else if (isSameCmd(Constants.CMD_AW_86880600, msgContentHeader)) {
			byte[] msgPowerSavingModeBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgPowerSavingModeBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);

			return setPowerSavingMode(msgPowerSavingModeBody);
		} else if (isSameCmd(Constants.CMD_AW_86880900, msgContentHeader)) {
			byte[] msgPowerSavingModeBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgPowerSavingModeBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return getPowerSavingMode(msgPowerSavingModeBody);
		} else if (isSameCmd(Constants.CMD_AW_86890600, msgContentHeader)) {
			byte[] msgMuteModeBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgMuteModeBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return setMuteMode(msgMuteModeBody);
		} else if (isSameCmd(Constants.CMD_AW_86890700, msgContentHeader)) {
			byte[] msgMuteModeBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgMuteModeBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return getMuteMode(msgMuteModeBody);
		} else if (isSameCmd(Constants.CMD_AW_808E0500, msgContentHeader)) {
			byte[] msgBleNameBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN - 1];
			System.arraycopy(msgContentBody, 1, msgBleNameBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN - 1);
			return null; //app ui handle
		}
		// return "CMD is NOT FOUND in Bes Watch Protocol Excel Sheet.";
		return new String[0];
	}

	public static CmdPackageHeader parseMultiPackageHeader(byte[] msgContentByte) {
		int index = byteToBigInteger(msgContentByte, Constants.MULTI_PACKAGE_INDEX_START, Constants.MULTI_PACKAGE_PACK_NUM_START);

		int num = byteToBigInteger(msgContentByte, Constants.MULTI_PACKAGE_PACK_NUM_START, Constants.MULTI_PACKAGE_PACK_NUM_START + 2);

		byte[] cmdId = new byte[2];
		System.arraycopy(msgContentByte, Constants.MULTI_PACKAGE_CMD_START, cmdId, 0, 2);
		int length = byteToBigInteger(msgContentByte, Constants.MULTI_PACKAGE_LEN_START, msgContentByte.length);
		Log.i(TAG, "parseMultiPackage ---index=" + index + ",totalnum=" + num + ",length=" + length);
		CmdPackageHeader dph = new CmdPackageHeader(num, index, length, cmdId);

		return dph;
	}

	public static void parseBikeDataMultiPackage(byte[] msgContentByte) {
		int index = byteToBigInteger(msgContentByte, Constants.MULTI_PACKAGE_INDEX_START, Constants.MULTI_PACKAGE_PACK_NUM_START);
		Log.i(TAG, "parseBikeDataMultiPackage ---index=" + index);

		// first package,parse multi package header
		if (index == 0) {
			Log.i(TAG, "parseBikeDataMultiPackage ---parse multi package header");
			byte[] packageHeader = new byte[Constants.MULTI_FIRST_PACKAGE_HEADER_LEN];
			System.arraycopy(msgContentByte, 0, packageHeader, 0, Constants.MULTI_FIRST_PACKAGE_HEADER_LEN);
			dph = parseMultiPackageHeader(packageHeader);
			setMsgId(dph.cmdId);
		}

		if (index == 0) {
			msgContentSavingByte = new byte[dph.packagelength];
			System.arraycopy(msgContentByte, Constants.MULTI_FIRST_PACKAGE_HEADER_LEN, msgContentSavingByte, 0, msgContentByte.length - Constants.MULTI_FIRST_PACKAGE_HEADER_LEN);
			savedLength = msgContentByte.length - Constants.MULTI_FIRST_PACKAGE_HEADER_LEN;
			Log.i(TAG, "parseBikeDataMultiPackage ---receive data =" + savedLength);
		} else {
			if (index <= dph.packageTotalNum - 1) {
				System.arraycopy(msgContentByte, Constants.MULTI_OTHERS_PACKAGE_HEADER_LEN, msgContentSavingByte, savedLength, msgContentByte.length - Constants.MULTI_OTHERS_PACKAGE_HEADER_LEN);
				savedLength = savedLength + msgContentByte.length - Constants.MULTI_OTHERS_PACKAGE_HEADER_LEN;
				Log.i(TAG, "parseBikeDataMultiPackage ---receive data savedLength =" + savedLength);
				if (index == dph.packageTotalNum - 1) {
					// for test to junting
					String ret = ArrayUtil.toHex(msgContentSavingByte);
					// writeTOFileNew(ret, "OriginData", "test", "txt", true);
				}
			}
		}
	}

	public static void startBikeDataAnalyze(byte[] msgContByte) {
		if (msgContByte == null || msgContByte.length < Constants.CMD_HEADER_LEN) {
			Log.i(TAG, "startBikeDataAnalyze(Str): ----- Invalid data");
			return;
		}

		if (msgContByte[0] == Constants.GENERAL_PROTOCOL_MULTI_PKG_SIGN) {
			Log.i(TAG, "startBikeDataAnalyze(Str): ----- multi package");
			parseBikeDataMultiPackage(msgContByte);
			return;
		}

		byte[] msgContentHeader = new byte[Constants.CMD_HEADER_LEN];
		byte[] msgContentBody = new byte[msgContByte.length - Constants.CMD_HEADER_LEN];
		System.arraycopy(msgContByte, 0, msgContentHeader, 0, Constants.CMD_HEADER_LEN);
		setMsgId(msgContentHeader);
		System.arraycopy(msgContByte, 4, msgContentBody, 0, msgContByte.length - Constants.CMD_HEADER_LEN);
	}

	/* tool methods */
	public static String getFolderPath() {
		String pathString = mPath;
		isExist(pathString);
		pathString += "/";
		return pathString;
	}

	public static void isExist(String path) {
		File file = new File(path);
		// 判断文件夹是否存在,如果不存在则创建文件夹
		if (!file.exists()) {
			file.mkdirs();
		}
	}

	public static boolean isStringEmpty(String str) {
		return str == null || str.isEmpty();
	}

	public static boolean writeTOFileNew(Object obj, String path, String fileName, String fileType, boolean first) {
		isExist(path);
		if (!isStringEmpty(fileType)) {
			path = path + fileName + fileType;
		} else {
			path = path + fileName;
		}

		File file = new File(path);
		Log.i(TAG, "writeTOFile: path" + path);
		try {
			if (first) {
				file.delete();
				// return;
			}
			if (!file.exists()) {
				file.createNewFile();
			} else {
				file.delete();
			}
			FileOutputStream stream = new FileOutputStream(file, false);

			if (obj.getClass() == String.class) {
				String temp = (String) obj;
				byte[] buf = temp.getBytes("UTF-8");
				stream.write(buf);
				stream.flush();
				stream.close();
			} else if (obj.getClass() == byte[].class) {
				byte[] buf = (byte[]) obj;
				stream.write(buf);
				stream.close();
			}
		} catch (IOException e) {
			long availableSize = SDCardUtils.getExternalAvailableSize();
			Log.i(TAG, "writeTOFileNew availableSize = " + availableSize);
			e.printStackTrace();
			return false;
		}
		return true;
	}

	public static boolean isSameCmd(byte[] arr1, byte[] arr2) {
		if (0 == arr1.length || 0 == arr2.length) {
			return false;
		}

		int n = min(arr1.length, arr2.length);

		for (int i = 0; i < n; i++) {
			if (arr1[i] != arr2[i]) {return false;}
		}
		return true;
	}

	// byte array to string array
	public static String[] byteArrayToStrArray(byte[] byteArray) {
		String[] strArray = new String[byteArray.length];
		for (int i = 0; i < byteArray.length; i++) {
			strArray[i] = String.valueOf(byteArray[i]);
		}
		return strArray;
	}

	// byte array to Binary string array
	public static String[] hexArrayToBinaryArray(byte[] hexBytes) {
		String[] binaryStrings = new String[hexBytes.length];
		for (int i = 0; i < hexBytes.length; i++) {
			int temp = hexBytes[i] & 0xFF;
			binaryStrings[i] = String.format("%8s", Integer.toBinaryString(temp)).replace(' ', '0');
		}
		return binaryStrings;
	}

	// 十六进制字节数组转十进制字符串数组
	// byte array to decimal string array
	public static String[] byteArrayToDecimalStringArray(byte[] byteArray) {
		String[] stringArray = new String[byteArray.length];
		for (int i = 0; i < byteArray.length; i++) {
			stringArray[i] = String.valueOf(byteArray[i] & 0xFF); // 将byte转换为十进制字符串
		}
		return stringArray;
	}

	// 字节数组转char数组
	// byte array to char
	public static String byteArrayToChar(byte[] byteArray, java.nio.charset.Charset sets) {
		// 将byte数组转换为字符串
		String str = new String(byteArray, sets);
		// 将字符串转换为char数组
		return str;
	}

	// 多位字节转成大整数字符串
	// byte array to Hex str
	public static String byteToBigIntegerStr(byte[] msgContentByte, int startIndex, int endIndex) {
		if (msgContentByte == null || endIndex > msgContentByte.length) {
			throw new IllegalArgumentException("Invalid byte array or range for number conversion");
		}

		/*
		 * StringBuilder numStr = new StringBuilder(); for (int i = startIndex; i < endIndex; i++) { //
		 * 将byte转换为unsigned，以便正确处理负数 int unsignedByte = msgContentByte[i] & Constants.BYTE_MASK; // 将16进制数字转换为十进制字符串
		 * numStr.append(Integer.toString(unsignedByte, Constants.DECIMAL_RADIX)); } return numStr.toString();
		 */

		byte[] msgContent = new byte[endIndex - startIndex];
		System.arraycopy(msgContentByte, startIndex, msgContent, 0, endIndex - startIndex);
		byte[] reversedBytes = reverseArray(msgContent);
		BigInteger bigInteger = new BigInteger(1, reversedBytes);

		return bigInteger.toString();
	}

	public static int byteToBigInteger(byte[] msgContentByte, int startIndex, int endIndex) {
		if (msgContentByte == null || endIndex > msgContentByte.length) {
			throw new IllegalArgumentException("Invalid byte array or range for number conversion");
		}

		byte[] msgContent = new byte[endIndex - startIndex];
		System.arraycopy(msgContentByte, startIndex, msgContent, 0, endIndex - startIndex);
		byte[] reversedBytes = reverseArray(msgContent);
		BigInteger bigInteger = new BigInteger(1, reversedBytes);

		return bigInteger.intValue();
	}

	public static byte[] reverseArray(byte[] original) {
		if (original == null) {
			return null;
		}
		byte[] reversed = new byte[original.length];
		System.arraycopy(original, 0, reversed, 0, original.length);
		for (int i = 0, j = original.length - 1; i < j; i++, j--) {
			byte temp = reversed[i];
			reversed[i] = reversed[j];
			reversed[j] = temp;
		}
		return reversed;
	}

	public static String hexStrToStr(String hexStr) {
		if (hexStr == null || hexStr.equals("")) {
			return null;
		}
		byte[] bytes = new byte[hexStr.length() / 2];
		for (int i = 0; i < hexStr.length(); i += 2) {
			bytes[i / 2] = (byte) ((Character.digit(hexStr.charAt(i), 16) << 4) + Character.digit(hexStr.charAt(i + 1), 16));
		}
		return new String(bytes);
	}

	// 多位字节数组转成拼接的字符串
	// byte array to spliced str
	public static String bytesToSplicedString(byte[] msgContentByte, int startIndex, int endIndex) {
		if (msgContentByte == null || endIndex > msgContentByte.length) {
			throw new IllegalArgumentException("Invalid byte array or range for version information");
		}

		StringBuilder str = new StringBuilder();
		for (int i = startIndex; i < endIndex; i++) {
			str.append((char) msgContentByte[i]);
		}
		return str.toString();
	}

	// unix 时间戳转时间
	public static String timeConversion(long unixTimestamp) {
		Date date = new Date(unixTimestamp * 1000L); // 将Unix时间戳转换为Date对象
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 指定输出格式
		String formattedDate = sdf.format(date); // 格式化日期

		return formattedDate;
	}

	// 单个byte转成16进制字符串
	public static String bytesToHex(byte bytes) {
		StringBuilder hexString = new StringBuilder();
		String hex = Integer.toHexString(0xFF & bytes);
		hexString.append(hex);
		return hexString.toString();
	}

	public static String bytesToHex(byte[] bytes) {
		if (bytes == null) {
			return null;
		}
		StringBuilder hexString = new StringBuilder();
		for (byte b : bytes) {
			hexString.append(String.format("%02X", b));
		}
		return hexString.toString();
	}

	public static byte HexToBinary(byte bytes) {
		int intValue = bytes & 0xFF;
		// 将整数转换为2进制字节
		return (byte) intValue;
	}

	public static int HexToDecimal(byte bytes) {
		String hexStr = String.format("%02X", bytes);
		// 将十六进制字符串转换为十进制整数
		return Integer.parseInt(hexStr, 16);
	}

	public static boolean isBitOne(int n, int k) {
		// 创建一个掩码，只有第k位是1，其余位都是0
		int mask = 1 << (k - 1); // 2的（k-1）次方
		// 使用与操作(&)来检查第k位是否为1
		return (n & mask) != 0;
	}

	public static String hourAndMinutesFormat(String hourStr, String minuteStr) {
		String hourstr = String.format("%02d", Integer.parseInt(hourStr));
		String minutestr = String.format("%02d", Integer.parseInt(minuteStr));
		String str = hourstr + ":" + minutestr;

		return str;
	}

	/*
	 * string[0]:<身高> string[1]:<体重> string[2]:<步长> string[3]:<性别> 0：男性，1：女性 string[4]:<跑步步长> string[5]<年龄>
	 */
	private static String[] getPersonalInfo(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getPersonalInfo(Str): ----- getPersonalInfo: null");
			return null;
		}
		String[] personalInfoStr = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : personalInfoStr) {
			Log.i(TAG, "getPersonalInfo(Str):" + s);
		}
		Log.i(TAG, "getPersonalInfo(Str): ----- height:" + personalInfoStr[0] + "weight:" + personalInfoStr[1] + "step:" + personalInfoStr[2] + "gender:" + personalInfoStr[3] + "Running stride:" + personalInfoStr[4] + "age:" + personalInfoStr[5]);
		return personalInfoStr;
	}

	/* 2023-12-5,15:36:08,gmt:+8:00 */
	public static String[] getDeviceTime(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDeviceTime(Str): ----- getDeviceTime: null");
			return null;
		}
		String[] dateTimeStr = new String[10];
		// 提取时间信息
		for (int i = 0; i < dateTimeStr.length; i++) {
			if (i == Constants.TIME_ZONE_SIGN_INDEX) {
				byte signByte = msgContentByte[i];
				dateTimeStr[i] = signByte == Constants.TIME_ZONE_SIGN_POSITIVE ? "+" : (signByte == Constants.TIME_ZONE_SIGN_NEGATIVE ? "-" : "?");
			} else {
				dateTimeStr[i] = Integer.toString(msgContentByte[i]);
			}
		}
		for (int i = 0; i < dateTimeStr.length; i++) {
			// 如果数字长度不足两位，前面补0
			if (i != Constants.TIME_ZONE_SIGN_INDEX) {
				dateTimeStr[i] = String.format("%02d", Integer.parseInt(dateTimeStr[i]));
			}
		}
		String[] stringArray = new String[1];
		stringArray[0] = dateTimeStr[0] + "" + dateTimeStr[1] + " " + dateTimeStr[2] + "." + dateTimeStr[3] + " " + dateTimeStr[4] + ":" + dateTimeStr[5] + ":" + dateTimeStr[6] + " " + dateTimeStr[7] + " " + dateTimeStr[8] + "：" + dateTimeStr[9];
		for (String s : stringArray) {
			Log.i(TAG, "getDeviceTime(Str):" + s);
		}
		/*
		 * Log.i(TAG, "getDeviceTime(Str): ----- time:" + dateTimeStr[0] + "" + dateTimeStr[1] + " " + dateTimeStr[2] +
		 * "." + dateTimeStr[3] + " " + dateTimeStr[4] + ":" + dateTimeStr[5] + ":" + dateTimeStr[6] + " " +
		 * dateTimeStr[7] + " " + dateTimeStr[8] + "：" + dateTimeStr[9]);
		 */

		return stringArray;
	}

	// string[0]:<电量百分比>
	private static String[] getBatteryLevel(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getBatteryLevel(Str): ----- getBatteryLevel: null");
			return null;
		}

		String[] str = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : str) {
			Log.i(TAG, "getBatteryLevel(Str):" + s);
		}
		// Log.i(TAG, "getBatteryLevel(Str): ----- battery level:" + str[0]);

		return str;
	}

	/*
	 * string[0]是否佩戴 0 - 未佩戴 1 - 已佩戴
	 */
	public static String[] getDeviceWornStatus(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDeviceWornStatus(Str): ----- getDeviceWornStatus: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getDeviceWornStatus(Str):" + s);
		}
		// Log.i(TAG, "getDeviceWornStatus(Str): ----- device worn status:" + stringArray[0]);

		return stringArray;
	}

	/* CMD analyzing methods multi package */
	/* CMD analyzing methods information */

	/*
	 * string[0]: 是否充电 0 - 未充电 1 - 充电中
	 */
	public static String[] getDeviceChargeStatus(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDeviceChargeStatus(Str): ----- getDeviceChargeStatus: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getDeviceChargeStatus(Str):" + s);
		}
		// Log.i(TAG, "getDeviceChargeStatus(Str): ----- device charge status:" + stringArray[0]);

		return stringArray;
	}

	/**
	 * string[0]<开关> <开关>: 0-关闭  1-开启
	 * string[1]<开始时间-小时>
	 * strimg[2]<开始时间-分钟>
	 * string[3]<结束时间-小时>
	 * string[4]<结束时间-分钟>
	 */
	public static String[] getLiftWristToViewSetting(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getLiftWristToViewSetting(Str): ----- getLiftWristToViewSetting: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		// time format need to modify
		for (int i = 1; i < stringArray.length; i++) {
			// 如果数字长度不足两位，前面补0
			stringArray[i] = String.format("%02d", Integer.parseInt(stringArray[i]));
		}
		for (String s : stringArray) {
			Log.i(TAG, "getLiftWristToViewSetting(Str):" + s);
		}

		/*
		 * Log.i(TAG, "getLiftWristToViewSetting(Str): ----- status:" + stringArray[0] + " From:" + stringArray[1] + ":"
		 * + stringArray[2] + " To:" + stringArray[3] + ":" + stringArray[4]);
		 */
		return stringArray;
	}

	// string[0]:<设备序列号> 当前支持6或12字节
	public static String[] getSerialNumber(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getSerialNumber(Str): ----- SerialNumber: null");
			return null;
		}
		String[] stringArray = new String[1];
		stringArray[0] = byteArrayToChar(msgContentByte, StandardCharsets.US_ASCII);
		Log.i(TAG, "getSerialNumber(Str): ----- SerialNumber:" + stringArray[0]);

		return stringArray;
	}

	/*
	 * String[0]:<温度单位>: 0 - 摄氏度, 1- 华氏度 String[1]:<自动测量间隔>: 单位分钟 测试没有返回该值
	 */
	public static String[] getTempParams(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getTempParams(Str): ----- getTempParams: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getTempParams(Str): ----- :" + s);
		}
		/*
		 * Log.i(TAG, "getTempParams(Str): ----- measuring unit :" + stringArray[0] + " interval time:" +
		 * stringArray[1]);
		 */
		return stringArray;
	}

	/*
	 * string[0]:<距离单位>: 0: 千米 1: 英里
	 */
	public static String[] getDistanceUnit(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDistanceUnit(Str): ----- getDistanceUnit: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getDistanceUnit(Str):" + s);
		}

		// Log.i(TAG, "getDistanceUnit(Str): ----- distanceunit:"+stringArray[0]);
		return stringArray;
	}

	/* string[0]:<BLE地址(6)> */
	public static String[] getMacAddress(Context context,byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getMacAddress(Str): ----- getMacAddress: null");
			return null;
		}
		// 提取BLE mac地址
		StringBuilder macAddress = new StringBuilder(msgContentByte.length);
		for (int i = 0; i < msgContentByte.length; i++) {
			macAddress.insert(0, String.format(":%02X", msgContentByte[i]));
		}
		macAddress.delete(0, 1); // 移除最前面的":"
		String[] strMacAddress = new String[1];
		strMacAddress[0] = macAddress.toString();
		for (String s : strMacAddress) {
			mMacAddress = s;
			Log.i(TAG, "getMacAddress(Str):" + s);
		}
		SPHelper.putPreference(context, "KEY_MAC_ADDRESS_ID", mMacAddress);
		return strMacAddress;
	}

	// string[0]:<固件版本(8)>
	public static String[] getFirmwareVersion(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getFirmwareVersion(Str): ----- getFirmwareVersion: null");
			return null;
		}

		// 提取固件版本
		StringBuilder firmwareVersion = new StringBuilder(msgContentByte.length);
		for (int i = 0; i < msgContentByte.length; i++) {
			firmwareVersion.append((char) msgContentByte[i]);
		}
		String[] str = new String[1];
		str[0] = firmwareVersion.toString();
		for (String s : str) {
			Log.i(TAG, "getFirmwareVersion(Str):" + s);
		}

		return str;
	}

	// String[0]: <心率自动测量间隔>：单位分钟
	public static String[] getAutomaticHeartRateInterval(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getAutomaticHeartRateInterval(Str): ----- getAutomaticHeartRateInterval: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getAutomaticHeartRateInterval(Str):" + s);
		}

		return stringArray;
	}

	// string[0]:<音量百分比>
	public static String[] getSoundVolume(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getSoundVolume(Str): ----- getSoundVolume: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getSoundVolume(Str):" + s);
		}

		return stringArray;
	}

	// 返回都是0，需要实际数据测试
	/*
	 * String[0]:<联系人总数> String[1]:<姓名1> String[2]:<电话号码1> ... <姓名n><电话号码n>
	 */
	public static String[] getPhoneBook(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getPhoneBook(Str): ----- getPhoneBook: null");
			return null;
		}

		int stringArrayLength = 1 + (msgContentByte.length - 1) / 3;
		String[] stringArray = new String[stringArrayLength];
		stringArray[0] = String.valueOf(msgContentByte[0]);
		for (int i = 1, j = 1; i < (msgContentByte.length - 1); i += 3) {
			stringArray[j] = bytesToSplicedString(msgContentByte, i, i + 3);
			j++;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getPhoneBook(Str):" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<宽(2)>毫米 string[1]：<长(2)>毫米 string[2]:<形状> 形状: 0-方形 1-圆形
	 */
	public static String[] getWatchSize(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getWatchSize(Str): ----- getWatchSize: null");
			return null;
		}

		String[] stringArray = new String[3];
		int startIndex = Constants.INFO_STAERTER;
		int endIndex = startIndex + Constants.WATCH_SIZE_BYTE_LEN;

		String width = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
		startIndex = endIndex;
		endIndex += Constants.WATCH_SIZE_BYTE_LEN;
		String length = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
		String shape = String.valueOf(msgContentByte[4]);

		stringArray[0] = width;
		stringArray[1] = length;
		stringArray[2] = shape;
		for (String s : stringArray) {
			Log.i(TAG, "getWatchSize(Str):" + s);
		}
		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setPersonalInfo(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setPersonalInfo(Str): ----- setPersonalInfo: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setPersonalInfo(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setTimeFormat(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setTimeFormat(Str): ----- setTimeFormat: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setTimeFormat(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setDeviceMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setDeviceMode(Str): ----- setDeviceMode: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setDeviceMode(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setParingPhoneType(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setParingPhoneType(Str): ----- setParingPhoneType: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setParingPhoneType(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setDeviceTime(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setDeviceTime(Str): ----- setDeviceTime: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setDeviceTime(Str): status :" + s);
			if ("1".equals(s)) {
				setMsgCallBackId(Constants.APP_SYNC_TIME_SUCCESS);
			}
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setTimeZone(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setTimeZone(Str): ----- setTimeZone: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setTimeZone(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setHandPreference(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setHandPreference(Str): ----- setHandPreference: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setHandPreference(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setHandShowScreen(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setHandShowScreen(Str): ----- setHandShowScreen: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setHandShowScreen(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setWristToView(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setWristToView(Str): ----- setWristToView: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setWristToView(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setSN(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSN(Str): ----- setSN: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSN(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setPairingState(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setPairingState(Str): ----- setPairingState: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setPairingState(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setDistanceDisplayUnit(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setDistanceDisplayUnit(Str): ----- setDistanceDisplayUnit: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setDistanceDisplayUnit(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setSoundVolume(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSoundVolume(Str): ----- setSoundVolume: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSoundVolume(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setPhoneBook(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setPhoneBook(Str): ----- setPhoneBook: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setPhoneBook(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] configWeatherControlInfo(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setWeatherControlInfo(Str): ----- setWeatherControlInfo: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setWeatherControlInfo(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * stringArray[0] is mac address; stringArray[1] is bt name;
	 */
	public static String[] switchAndGetBroadcastNameAndMacAddressOfBt(byte[] msgContentByte) {
		if (msgContentByte == null || msgContentByte.length < 1) {
			Log.i(TAG, "switchAndGetBroadcastNameAndMacAddressOfBt(Str): ----- switchAndGetBroadcastNameAndMacAddressOfBt: null");
			return null;
		}
		// 提取BT信息
		StringBuilder btMac = new StringBuilder(Constants.BT_MAC_ENDINDEX);
		for (int i = 0; i < Constants.BT_MAC_ENDINDEX; i++) {
			btMac.insert(0, String.format(":%02X", msgContentByte[i]));
		}
		btMac.delete(0, 1); // 移除最前面的":"
		String btName = bytesToSplicedString(msgContentByte, Constants.BT_MAC_ENDINDEX, msgContentByte.length);
		btName = btName.replaceAll("\0", "");

		String[] stringArray = new String[2];
		stringArray[0] = btMac.toString();
		stringArray[1] = btName;
		for (String s : stringArray) {
			Log.i(TAG, "switchAndGetBroadcastNameAndMacAddressOfBt(Str): " + s);
		}

		return stringArray;
	}

	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] unBindBT(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "unBindBT(Str): ----- unBindBT: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "unBindBT(Str): status :" + s);
			// app 解绑成功的回调
			if ("1".equals(s)) {
				setMsgCallBackId(Constants.APP_UNBIND_DEVICE_SUCCESS);
			}
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setCallAlarm(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setCallAlarm(Str): ----- setCallAlarm: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setCallAlarm(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setScreenBrightness(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setScreenBrightness(Str): ----- setScreenBrightness: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setScreenBrightness(Str): status :" + s);
		}

		return stringArray;
	}

	// 返回数据是0， 需要实际数据测试
	/*
	 * stringArray[0] = data 支持获取7天，0为当天，1为昨天，以此类推 stringArray[1] = step
	 */
	public static String[] getHistoryStepData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getHistoryStep(Str): ----- getHistoryStep: null");
			return null;
		}

		String date = String.valueOf(msgContentByte[0]);
		int startIndex = Constants.DAILY_STEP_DATE_LEN;
		int endIndex = startIndex + Constants.CMD_HEADER_LEN;
		;
		String step = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);

		String[] stringArray = new String[2];
		stringArray[0] = date;
		stringArray[1] = step;
		for (String s : stringArray) {
			Log.i(TAG, "getHistoryStep(Str) :" + s);
		}

		return stringArray;
	}

	// 返回数据为0，需要实际数据测试
	// special instructions
	// stringArray[i] 是ECGInfo类， new ECGInfo(stringArray[i]), 可以得出HR，DBP,SBP,RR, 会有多组HR，DBP,SBP,RR
	// 然后按照time1：HR，DBP,SBP,RR ， time2：HR，DBP,SBP,RR 。。。顺序存储
	public static String[] geAutoECGData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "geAutoECGMultiData(Str): ----- geAutoECGMultiData: null");
			return null;
		}

		/*
		 * arraylist ArrayList<ECGInfo> ecgInfosList = new ArrayList<>();
		 *
		 * for(int i = 0; i < msgContentByte.length; i += 4){ ECGInfo ecginfos = new ECGInfo(); ecginfos.HRValue =
		 * Integer.toString(msgContentByte[i]); ecginfos.DBPValue = Integer.toString(msgContentByte[i+1]);
		 * ecginfos.SBPValue = Integer.toString(msgContentByte[i+2]); ecginfos.RRValue =
		 * Integer.toString(msgContentByte[i+3]); ecgInfosList.add(ecginfos); }
		 *
		 * //把arraylist转成string[] String[] stringArray = new String[ecgInfosList.size()];
		 *
		 * for (int i = 0; i < ecgInfosList.size(); i++) { stringArray[i] = ecgInfosList.get(i).toString(); }
		 */
		String[] stringArray = new String[msgContentByte.length / 4];
		for (int i = 0, ArrayIndex = 0; i < msgContentByte.length; i += 4) {
			ECGInfo ecginfos = new ECGInfo();
			ecginfos.HRValue = Integer.toString(msgContentByte[i]);
			ecginfos.DBPValue = Integer.toString(msgContentByte[i + 1]);
			ecginfos.SBPValue = Integer.toString(msgContentByte[i + 2]);
			ecginfos.RRValue = Integer.toString(msgContentByte[i + 3]);
			stringArray[ArrayIndex++] = ecginfos.toString();
		}
		for (String str : stringArray) {
			ECGInfo info = new ECGInfo(str); // app通过这个函数获取数据
			Log.i(TAG, "geAutoECGMultiData(Str): HRValue =" + info.HRValue + ",DBPValue =" + info.DBPValue + ",SBPValue =" + info.SBPValue + ",RRValue =" + info.RRValue);
		}
		return stringArray;
	}

	// 手表端没有返回
	// special instructions
	// string[0]...依次存取出来的temperature
	// ???是否有多包， 什么结构
	public static String[] getHistoryTempData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getHistoryTempData(Str): ----- getHistoryTempData: null");
			return null;
		}

		String[] stringArray = new String[msgContentByte.length / 2];
		for (int i = 0, j = 0; i < msgContentByte.length; i += 2) {
			stringArray[j] = byteToBigIntegerStr(msgContentByte, i, i + 2);
			j++;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getHistoryTempData(Str): " + s);
		}
		return stringArray;
	}

	// 返回数据为0， 需要实际数据测试
	// special instructions
	// 每个string[i]都是步数
	public static String[] getFiveMinutesWalk(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getFiveMinutesWalkMultiPack(Str): ----- getFiveMinutesWalkMultiPack: null");
			return null;
		}

		String[] stringArray = new String[msgContentByte.length / 2];
		for (int i = 0, j = 0; i < msgContentByte.length; i += 2) {
			stringArray[j] = byteToBigIntegerStr(msgContentByte, i, i + 2);
			j++;
		}

		for (String s : stringArray) {
			Log.i(TAG, "getFiveMinutesWalk(Str): " + s);
		}
		return stringArray;
	}

	/* CMD analyzing methods fitness */

	/*
	 * string[0]: time <Unix时间戳(4)> string[1]: value <数据(2)>
	 */
	public static String[] getLatestHealthData(byte[] msgContentByte) {
		if (msgContentByte == null || msgContentByte.length < 1) {
			Log.i(TAG, "getLatestHealthData(Str): ----- getLatestHealthData: null");
			return null;
		}

		String[] stringArray = new String[2];
		byte[] temp = new byte[4];
		System.arraycopy(msgContentByte, 0, temp, 0, 4);
		byte[] reversedBytes = reverseArray(temp);
		BigInteger bigInteger = new BigInteger(1, reversedBytes);
		long time = bigInteger.longValue();
		stringArray[0] = timeConversion(time);
		stringArray[1] = byteToBigIntegerStr(msgContentByte, 4, 6);

		for (String s : stringArray) {
			Log.i(TAG, "getLatestHealthData(Str): " + s);
		}

		return stringArray;
	}

	// 返回数据为0， 需要实际数据测试
	// string[i]是每分钟睡眠状态
	/*
	 * 0 - 清醒 1 - 浅睡 2 - 深睡 3 - 快速眼动
	 */
	public static String[] getOneMinutesSleep(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getOneMinutesSleepMultiPack(Str): ----- getOneMinutesSleepMultiPack: null");
			return null;
		}

		Log.i(TAG, "getOneMinutesSleep(Str): msgContentByte.length " + msgContentByte.length);
		String[] stringArray = new String[msgContentByte.length * 4];

		byte[] msgContentByteTemp = new byte[msgContentByte.length];
		for (int i = 0, k = 0; i < msgContentByte.length; i++) {
			msgContentByteTemp[i] = HexToBinary(msgContentByte[i]);
			for (int j = 0; j < Constants.MULTI_BYTE_BIT_LEN; j += 2) {
				int mask = (msgContentByteTemp[i] >> j) & 0b11; // 使用掩码取出两位
				int decimal = Integer.parseInt(String.valueOf(mask), 2);
				stringArray[k] = String.valueOf(decimal);
				k++;
			}
		}
		int num = 0;
		for (String s : stringArray) {
			Log.i(TAG, "getOneMinutesSleep(Str): " + s + "num " + num);
			num++;
		}
		return stringArray;
	}

	// 手表端没有返回
	// 每个string[i]都是跑步步数
	public static String[] getFiveMinutesRunning(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getFiveMinutesRunning(Str): ----- getFiveMinutesRunning: null");
			return null;
		}

		String[] stringArray = new String[msgContentByte.length / 2];
		for (int i = 0, j = 0; i < msgContentByte.length; i += 2) {
			stringArray[j] = byteToBigIntegerStr(msgContentByte, i, i + 2);
			j++;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getFiveMinutesRunning(Str): " + s);
		}
		return stringArray;
	}

	// 返回数据是0， 需要实际数据测试
	// string[0]: 一共几条记录
	// string[i]是每个久坐得时间点
	public static String[] getSedentaryData(byte[] msgContentByte) {
		if (msgContentByte == null || msgContentByte.length < 1) {
			Log.i(TAG, "getSedentaryData(Str): ----- getSedentaryData: null");
			return null;
		}

		String[] stringArray = new String[(msgContentByte.length - 1) / 5 + 1];
		int recordNum = HexToDecimal(msgContentByte[0]);
		stringArray[0] = String.valueOf(recordNum);

		byte[] unixTime = new byte[4];
		for (int i = 1; i <= recordNum; i++) {
			System.arraycopy(msgContentByte, (1 + i * 5), unixTime, 0, 4);
			byte[] reversedBytes = reverseArray(unixTime);
			BigInteger bigInteger = new BigInteger(1, reversedBytes);
			long time = bigInteger.longValue();
			stringArray[i] = timeConversion(time); // sedentary data
		}

		for (String s : stringArray) {
			Log.i(TAG, "getSedentaryData(Str): " + s);
		}

		return stringArray;
	}

	// 返回数据为0，需要实际数据测试
	// 单包和多包都走这个
	// string[i]是ActivityConfigSummaryInfo类
	public static String[] getActivityConfigSummary(byte[] msgContentByte, int num) {
		if (msgContentByte == null) {
			Log.i(TAG, "getActivityConfigSummary(Str): ----- getActivityConfigSummary: null");
			return null;
		}

		String[] stringArray = new String[num + 1];
		stringArray[0] = String.valueOf(num);
		// ArrayList<ActivityConfigSummaryInfo> activityConfigSummaryInfosList = new ArrayList<>();
		Log.i(TAG, "getActivityConfigSummary(Str): ----- getActivityConfigSummary:enter");
		for (int i = 1, ArrayIndex = 1; i < msgContentByte.length;
			i += Constants.ActivitySummary.TOTAL_LEN) {
			ActivityConfigSummaryInfo acsInfos = new ActivityConfigSummaryInfo();
			acsInfos.activityIndex = String.valueOf(HexToDecimal(msgContentByte[i]));
			acsInfos.activityIdentity = bytesToSplicedString(msgContentByte, i + 1, i + 1 + Constants.ActivitySummary.ACTIVITY_IDENTITY_LENGTH);// ??不知道什么样的结构，可能需要修改
			acsInfos.activityCatalog = String.valueOf(HexToDecimal(msgContentByte[i + Constants.ActivitySummary.ACTIVITY_CATAGORY_INDEX]));
			acsInfos.activityType = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.ACTIVITY_TYPE_INDEX, i + Constants.ActivitySummary.UNIX_TIME_INDEX);
			acsInfos.activityTime = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.UNIX_TIME_INDEX, i + Constants.ActivitySummary.MAX_HR_INDEX);
			acsInfos.maxHR = String.valueOf(HexToDecimal(msgContentByte[i + Constants.ActivitySummary.MAX_HR_INDEX]));
			acsInfos.minHR = String.valueOf(HexToDecimal(msgContentByte[i + Constants.ActivitySummary.MIN_HR_INDEX]));
			acsInfos.paceSpeed = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.PACE_SPEED_INDEX, i + Constants.ActivitySummary.AVE_SPEED_INDEX);
			acsInfos.averageSpeed = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.AVE_SPEED_INDEX, i + Constants.ActivitySummary.DURATION_INDEX);
			acsInfos.duration = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.DURATION_INDEX, i + Constants.ActivitySummary.TOTAL_CAL_INDEX);
			acsInfos.totalCalories = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.TOTAL_CAL_INDEX, i + Constants.ActivitySummary.TOTAL_STEP_INDEX);
			acsInfos.totalSteps = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.TOTAL_STEP_INDEX, i + Constants.ActivitySummary.TOTAL_DISTANCE_INDEX);
			acsInfos.totalDistance = byteToBigIntegerStr(msgContentByte, i + Constants.ActivitySummary.TOTAL_DISTANCE_INDEX, i + Constants.ActivitySummary.TOTAL_DISTANCE_INDEX + Constants.ActivitySummary.TOTAL_DISTANCE_LEN);
			// activityConfigSummaryInfosList.add(acsInfos);
			stringArray[ArrayIndex++] = acsInfos.toString();
		}

		// activityConfigSummaryInfosList.toArray(stringArray);
		for (int index = 0; index < stringArray.length; index++) {
			if (index == 0) {
				Log.i(TAG, "getActivityConfigSummary(Str): ----- num:" + stringArray[0]);
			} else {
				ActivityConfigSummaryInfo info = new ActivityConfigSummaryInfo(stringArray[index]); // 调这个解出来各个值
				Log.i(TAG, "getActivityConfigSummary(Str): activityIndex =" + info.activityIndex + ",activityIdentity =" + info.activityIdentity + ",activityCatalog =" + info.activityCatalog + ",activityType =" + info.activityType + ",activityTime =" + info.activityTime + ",maxHR =" + info.maxHR + ",minHR =" + info.minHR + ",paceSpeed =" + info.paceSpeed + ",averageSpeed =" + info.averageSpeed + ",duration =" + info.duration + ",totalCalories =" + info.totalCalories + ",totalSteps =" + info.totalSteps + ",totalDistance =" + info.totalDistance);
				info = null;
			}
		}

		return stringArray;
	}

	// 发送无返回， 需要重新测试
	// 协议定义不清晰
	public static String[] getActivityConfigDetail(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getActivityConfigDetail(Str): ----- getActivityConfigDetail: null");
			return null;
		}

		String activityIdentity = bytesToSplicedString(msgContentByte, Constants.ActivityDetail.ACTIVITY_IDENTITY_INDEX, Constants.ActivityDetail.ACTIVITY_CATEGORY_INDEX);
		String activityCategory = String.valueOf(HexToDecimal(msgContentByte[Constants.ActivityDetail.ACTIVITY_CATEGORY_INDEX]));
		String activityType = byteToBigIntegerStr(msgContentByte, Constants.ActivityDetail.ACTIVITY_TYPE_INDEX, Constants.ActivityDetail.ACTIVITY_INC_DATA_TYPE_INDEX);
		String dataType = byteToBigIntegerStr(msgContentByte, Constants.ActivityDetail.ACTIVITY_INC_DATA_TYPE_INDEX, Constants.ActivityDetail.ACTIVITY_DURATION_INDEX);
		// byte[] hexTemp = new byte[4];
		// System.arraycopy(msgContentByte, Constants.ActivityDetail.ACTIVITY_INC_DATA_TYPE_INDEX, hexTemp, 0, 4);
		// String[] dataType = hexArrayToBinaryArray(hexTemp);
		String duration = byteToBigIntegerStr(msgContentByte, Constants.ActivityDetail.ACTIVITY_DURATION_INDEX, Constants.ActivityDetail.UNIX_TIME_INDEX);
		String unixTime = byteToBigIntegerStr(msgContentByte, Constants.ActivityDetail.UNIX_TIME_INDEX, Constants.ActivityDetail.UNIX_TIME_INDEX + 4);
		ArrayList<ActivityConfigDetailInfo> activityConfigDetailInfosList = new ArrayList<>();
		int listelementNum = 0;
		for (int i = Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH; i < msgContentByte.length; ) {
			ActivityConfigDetailInfo acdInfos = new ActivityConfigDetailInfo();
			int datalen = byteToBigInteger(msgContentByte, i + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH, i + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 2);
			acdInfos.dataType = byteToBigIntegerStr(msgContentByte, i + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 2, i + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 6);
			acdInfos.dateSampleRate = byteToBigIntegerStr(msgContentByte, i + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 6, i + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 8);
			int payloadlen = 1;
			if (Integer.valueOf(acdInfos.dataType) == 1) { // HR
				payloadlen = datalen - 6;
			} else if (Integer.valueOf(acdInfos.dataType) == 2) {// step
				payloadlen = (datalen - 6) / 2;
			} else if (Integer.valueOf(acdInfos.dataType) == 8) {// calorie
				payloadlen = (datalen - 6) / 4;
			} else if (Integer.valueOf(acdInfos.dataType) == 9) { // distance
				payloadlen = (datalen - 6) / 4;
			}
			acdInfos.data = new String[payloadlen];

			for (int j = 0, k = 0; j < payloadlen; j++) {
				if (Integer.valueOf(acdInfos.dataType) == 1) {
					acdInfos.data[j] = String.valueOf(HexToDecimal(msgContentByte[j + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 8]));
				}
				if (Integer.valueOf(acdInfos.dataType) == 2) {
					acdInfos.data[j] = byteToBigIntegerStr(msgContentByte, k + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 8, k + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 8 + 2);
					k += 2;
				}
				if (Integer.valueOf(acdInfos.dataType) == 8 || Integer.valueOf(acdInfos.dataType) == 9) {
					acdInfos.data[j] = byteToBigIntegerStr(msgContentByte, k + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 8, k + Constants.ActivityDetail.OVERVIEW_TOTAL_LENTH + 8 + 2);
					k += 4;
				}
			}
			i += datalen;
			activityConfigDetailInfosList.add(acdInfos);
			listelementNum++;
		}

		String[] stringArray = new String[6 + listelementNum];
		stringArray[0] = activityIdentity;
		stringArray[1] = activityCategory;
		stringArray[2] = activityType;
		stringArray[3] = dataType;
		stringArray[4] = duration;
		stringArray[5] = unixTime;
		for (int i = 6; i < activityConfigDetailInfosList.size(); i++) {
			stringArray[i] = activityConfigDetailInfosList.get(i).toString();
		}
		for (String s : stringArray) {
			Log.i(TAG, "getActivityConfigDetail(Str): " + s);
		}
		return stringArray;
	}

	/*
	 * String[0]:<是否全天开启> String[1]:<开启时间-小时(2)> String[2]:<结束时间-小时(2)> String[3]:<测量间隔>
	 */
	public static String[] getSPO2Para(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getSPO2Para(Str): ----- getSPO2Para: null");
			return null;
		}

		String[] stringArray = new String[4];
		String[] stringArrayTemp = byteArrayToDecimalStringArray(msgContentByte);
		stringArray[0] = stringArrayTemp[0];
		stringArray[1] = hourAndMinutesFormat(stringArrayTemp[1], stringArrayTemp[2]);
		stringArray[2] = hourAndMinutesFormat(stringArrayTemp[3], stringArrayTemp[4]);
		stringArray[3] = stringArrayTemp[5];
		for (String s : stringArray) {
			Log.i(TAG, "getSPO2Para(Str): " + s);
		}

		return stringArray;
	}

	// 返回数据为0，需要实际数据测试
	/* string[i]为血氧数值 */
	public static String[] getSPO2Data(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getSPO2Data(Str): ----- getSPO2Data: null");
			return null;
		}

		String[] stringArray = new String[msgContentByte.length / 2];
		for (int i = 0, j = 0; i < msgContentByte.length; i += 2) {
			stringArray[j] = byteToBigIntegerStr(msgContentByte, i, i + 2);
			j++;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getSPO2Data(Str): " + s);
		}

		return stringArray;
	}

	// 返回数据为0， 需要实际数据测试
	/* String[0]: <睡眠目标>分钟 */
	public static String[] getSleepTargetValue(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getSleepTargetValue(Str): ----- getSleepTargetValue: null");
			return null;
		}

		String stringSleepTargetValue = byteToBigIntegerStr(msgContentByte, Constants.INFO_STAERTER, msgContentByte.length);
		String[] stringArray = new String[1];
		stringArray[0] = stringSleepTargetValue;
		for (String s : stringArray) {
			Log.i(TAG, "getSleepTargetValue(Str): " + s);
		}
		return stringArray;
	}

	// 数据返回为0，需要实际数据测试
	/*
	 * String[0]:<开始时间> String[1]:<结束时间> String[2]:<浅睡时长> String[3]:<深睡时长> String[4]:<快速眼动时长> String[5]:<清醒时长>
	 * String[6]:<总睡眠时长>分钟
	 */
	public static String[] getSleepSummaryData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getSleepSummaryData(Str): ----- getSleepSummaryData: null");
			return null;
		}
		String[] stringArray = new String[msgContentByte.length / 2];
		int startIndex = Constants.INFO_STAERTER;
		int endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 0; i < msgContentByte.length / 2; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex;
			endIndex = startIndex + Constants.VALUE_LEN;
		}

		for (String s : stringArray) {
			Log.i(TAG, "getSleepSummaryData(Str): " + s);
		}
		return stringArray;
	}

	// 数据返回为0， 需要实际数据测试
	/*
	 * String[0]：<数据采样间隔>，默认60秒 String[i]：返回的多个距离数据>
	 */
	public static String[] getHistoryDistanceData(byte[] msgContentByte) {
		if (msgContentByte == null || msgContentByte.length < 1) {
			Log.i(TAG, "getHistoryDistanceData(Str): ----- getHistoryDistanceData: null");
			return null;
		}

		String[] stringArray = new String[(msgContentByte.length - 2) / 4 + 1];
		int startIndex = Constants.INFO_STAERTER;
		int endIndex = startIndex + Constants.VALUE_LEN;
		stringArray[0] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
		startIndex = endIndex;
		endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 1; i <= msgContentByte.length / 4; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex;
			endIndex = startIndex + Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getHistoryDistanceData(Str): " + s);
		}
		return stringArray;
	}

	/*
	 * String[0]:<数据采样间隔>，默认60分钟 String[i]返回的多个热量数据> 卡，float
	 */
	public static String[] getHistoryCaloryData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getHistoryCaloryData(Str): ----- getHistoryCaloryData: null");
			return null;
		}

		String[] stringArray = new String[(msgContentByte.length - 2) / 4 + 1];
		int startIndex = Constants.INFO_STAERTER;
		int endIndex = startIndex + Constants.VALUE_LEN;
		stringArray[0] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
		startIndex = endIndex;
		endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 1; i <= msgContentByte.length / 4; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex;
			endIndex = startIndex + Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getHistoryCaloryData(Str): " + s);
		}
		return stringArray;
	}

	/*
	 * String[0]<步数> String[1]<距离>米，float String[2]<热量>卡，float
	 */
	public static String[] getTodayFitnessData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getTodayFitnessData(Str): ----- getTodayFitnessData: null");
			return null;
		}
		String[] stringArray = new String[(msgContentByte.length) / 4];
		int startIndex = Constants.INFO_STAERTER;
		int endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 0; i < msgContentByte.length / 4; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex;
			endIndex = startIndex + Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getTodayFitnessData(Str): " + s);
		}
		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setDailyWalking(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setDailyWalking(Str): ----- setDailyWalking: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setDailyWalking(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setAutoHRInterval(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setAutoHRInterval(Str): ----- setAutoHRInterval: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setAutoHRInterval(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setHRLiveControl(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setHRLiveControl(Str): ----- setHRLiveControl: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setHRLiveControl(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setSPO2LiveControl(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSPO2LiveControl(Str): ----- setSPO2LiveControl: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);

		for (String s : stringArray) {
			Log.i(TAG, "setSPO2LiveControl(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setEraseFitnessData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setEraseFitnessData(Str): ----- setEraseFitnessData: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setEraseFitnessData(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setSportMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSportMode(Str): ----- setSportMode: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSportMode(Str): status :" + s);
		}
		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setUpdateVO2MaxValue(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setUpdateVO2MaxValue(Str): ----- setUpdateVO2MaxValue: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setUpdateVO2MaxValue(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setUpdateHRZoneValue(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setUpdateHRZoneValue(Str): ----- setUpdateHRZoneValue: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setUpdateHRZoneValue(Str): status :" + s);
		}
		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setLiveStepsControl(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setLiveStepsControl(Str): ----- setLiveStepsControl: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setLiveStepsControl(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setGpsControl(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setGpsControl(Str): ----- setGpsControl: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setGpsControl(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setSportModePause(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSportModePause(Str): ----- setSportModePause: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSportModePause(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setAutoPPGInterval(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setAutoPPGInterval(Str): ----- setAutoPPGInterval: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setAutoPPGInterval(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setSPO2Para(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSPO2Para(Str): ----- setSPO2Para: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSPO2Para(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setSleepTargetValue(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSleepTargetValue(Str): ----- setSleepTargetValue: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSleepTargetValue(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setStressPara(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setStressPara(Str): ----- setStressPara: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setStressPara(Str): status :" + s);
		}

		return stringArray;
	}

	// string[i]:压力值, 只取压力值
	public static String[] getStressHistoryData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getStressHistoryData(Str): ----- getStressHistoryData: null");
			return null;
		}

		int length = msgContentByte.length / 5;
		String[] stringArray = new String[length];
		Log.i(TAG, "getStressHistoryData(Str): ----- enter length = " + length);
		int startIndex = 3;
		int endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 0; i < length; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex + 3;
			endIndex = endIndex + 3 + Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getStressHistoryData(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] setMotionRecognition(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setMotionRecognition(Str): ----- setMotionRecognition: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setMotionRecognition(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<运动识别开关(4)> string[1]:<重复设置> string[2]:<倒计时时长> string[3]:<振动开关> string[4]:<时间段个数> string[5]:<开始时间1(2)>
	 * string[6]:<结束时间1(2)> string[7]:<开始时间2(2)> string[8]:<结束时间2(2)>… ...<开始时间n(2)><结束时间n(2)>
	 */
	public static String[] getMotionRecognition(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getMotionRecognition(Str): ----- getMotionRecognition: null");
			return null;
		}

		int num = HexToDecimal(msgContentByte[7]);
		String[] stringArray = new String[5 + num];
		// stringArray[0]
		stringArray[0] = byteToBigIntegerStr(msgContentByte, 0, 4);
		// stringArray[1]- stringArray[4] -
		for (int strindex = 1; strindex < 5 + num; strindex++) {
			stringArray[strindex] = String.valueOf(HexToDecimal(msgContentByte[3 + strindex]));
			if ((strindex >= 5) && (num > 0)) {
				String strStartHour = String.valueOf(HexToDecimal(msgContentByte[3 + strindex]));
				String strStartMin = String.valueOf(HexToDecimal(msgContentByte[3 + strindex + 1]));
				String strEndHour = String.valueOf(HexToDecimal(msgContentByte[3 + strindex + 2]));
				String strEndMin = String.valueOf(HexToDecimal(msgContentByte[3 + strindex + 3]));
				stringArray[strindex] = strStartHour + ":" + strStartMin + "-" + strEndHour + ":" + strEndMin;
			}
		}
		for (String s : stringArray) {
			Log.i(TAG, "getMotionRecognition(Str): " + s);
		}

		return stringArray;
	}

	/*
	 * string[i]:<固件功能> 共4字节，每个bit代表一种能力，0-具备该功能，1-不具备该功能 后面需要修改，是哪个能力
	 */
	public static String[] getFirmwareCapbility(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getFirmwareCapbility(Str): ----- getFirmwareCapbility: null");
			return null;
		}
		String[] stringArray = hexArrayToBinaryArray(msgContentByte);
		// String[] stringArray = new String[Constants.FIRMWARE_CAPBILITY_LEN];
		// System.arraycopy(temp, 0, stringArray, 0, Constants.FIRMWARE_CAPBILITY_LEN);
		for (String s : stringArray) {
			Log.i(TAG, "getFirmwareCapbility(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]：<闹钟总数> string[1]:<闹钟序号> string[2]:<重复设置>: bit=1开启, bit=0关闭 bit7: 开关 bit6: 周日 bit5: 周五 bit4: 周四 bit3: 周三
	 * bit2: 周二 bit1: 周一 bit0: 周日 如果bit0-6均为0，则闹钟只生效一次 string[3]:<小时> string[4]:<分钟> string[5]<闹钟名>: Unicode编码，不超过12字节
	 */
	public static String[] getAlarmConfig(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getAlarmConfig(Str): ----- getAlarmConfig: null");
			return null;
		}

		int num = HexToDecimal(msgContentByte[0]);
		String[] stringArray = new String[(msgContentByte.length - 1) / 6 + 1];
		stringArray[0] = String.valueOf(num);
		if (num > 0) {
			byte[] byteTemp = new byte[2];
			for (int i = 1; i < msgContentByte.length; i += 6) {
				AlarmInfo alarmInfo = new AlarmInfo();
				alarmInfo.Num = Integer.toString(msgContentByte[i]);
				int temp = msgContentByte[i + 1] & 0xFF;
				alarmInfo.RepeatSet = String.format("%8s", Integer.toBinaryString(temp)).replace(' ', '0');
				alarmInfo.HourValue = Integer.toString(msgContentByte[i + 2]);
				alarmInfo.MinuteValue = Integer.toString(msgContentByte[i + 3]);
				System.arraycopy(msgContentByte, i + 4, byteTemp, 0, 2);
				alarmInfo.AlarmName = byteArrayToChar(byteTemp, StandardCharsets.UTF_8);
				stringArray[i++] = alarmInfo.toString();
			}
			for (String s : stringArray) {
				AlarmInfo alarmInfo = new AlarmInfo(s);
				Log.i(TAG, "getAlarmConfig(Str): Num =" + alarmInfo.Num + ",RepeatSet =" + alarmInfo.RepeatSet + ",HourValue =" + alarmInfo.HourValue + ",MinuteValue =" + alarmInfo.MinuteValue + ",AlarmName" + alarmInfo.AlarmName);
			}
		}
		for (String s : stringArray) {
			Log.i(TAG, "getAlarmConfig(Str): " + s);
		}

		return stringArray;
	}

	/*
	 * string[0]:<开关> string[1]:<消息开关> string[2]:<抬腕亮屏开关> string[3]:<开始时间-小时> string[4]:<开始时间-分钟> string[5]:<结束时间-小时>
	 * string[6]:<结束时间-分钟>
	 */
	public static String[] getNoDisturbMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getNoDisturbMode(Str): ----- getNoDisturbMode: null");
			return null;
		}
		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getNoDisturbMode(Str):" + s);
		}

		return stringArray;
	}

	/*
	 * <表盘总数><表盘编号1(2)><表盘编号2(2)>… string[0] : dial total number string[1] : dial number 1 。。。
	 */
	public static String[] getDialList(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDialList(Str): ----- getDialList: null");
			return null;
		}
		String[] stringArray = new String[(msgContentByte.length - 1) / 2 + 1];
		String num = String.valueOf(msgContentByte[0]);
		stringArray[0] = num;
		int startIndex = 1;
		int endIndex = startIndex + Constants.VALUE_LEN;
		byte[] bytesTmp = new byte[2];
		for (int i = 1; i <= (msgContentByte.length - 1) / 2; i++) {
			// System.arraycopy(msgContentByte, startIndex, bytesTmp, 0, endIndex - startIndex);
			// bytesTmp = reverseArray(bytesTmp);
			// stringArray[i] = bytesToHex(bytesTmp); //直接表示成十六进制
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex); // 表示成十进制数
			startIndex = endIndex;
			endIndex += Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getDialList(Str):" + s);
		}

		return stringArray;
	}

	// String[0]: <当前表盘编号(2)>
	public static String[] getCurrentDial(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDialList(Str): ----- getDialList: null");
			return null;
		}

		String[] stringArray = new String[1];
		stringArray[0] = byteToBigIntegerStr(msgContentByte, Constants.INFO_STAERTER, msgContentByte.length);
		for (String s : stringArray) {
			Log.i(TAG, "getCurrentDial(Str):" + s);
		}
		return stringArray;
	}

	// String[0]:<开关>0-关闭，1-开启
	public static String[] getCompetitionInfoControl(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDialList(Str): ----- getDialList: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getCurrentDial(Str):" + s);
		}
		return stringArray;
	}

	// no test
	/*
	 * <status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] getDeviceControlFun(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDeviceControlFun(Str): ----- getDeviceControlFun: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getDeviceControlFun(Str):" + s);
		}
		return stringArray;
	}

	/*
	 * <图片总数><图片编号1><图片编号2>…… string[0] : pic total number string[1] ： pic number 1 。。。
	 */
	public static String[] getPicList(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getPicList(Str): ----- getPicList: null");
			return null;
		}
		String[] stringArray = new String[(msgContentByte.length - 1) / 2 + 1];
		String num = String.valueOf(msgContentByte[0]);
		stringArray[0] = num;
		int startIndex = 1;
		int endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 1; i <= (msgContentByte.length - 1) / 2; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex;
			endIndex += Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getPicList(Str):" + s);
		}

		return stringArray;
	}

	/*
	 * string[0] : <表盘总数> string[1] ： 表盘编号 1 string[2] ： 图片编号 1 。。。
	 */
	public static String[] getDialBackgroundPic(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getDialBackgroudPic(Str): ----- getDialBackgroudPic: null");
			return null;
		}
		String[] stringArray = new String[(msgContentByte.length - 1) / 2 + 1];
		stringArray[0] = String.valueOf(msgContentByte[0]);
		int startIndex = 1;
		int endIndex = startIndex + Constants.VALUE_LEN;
		for (int i = 1; i <= (msgContentByte.length - 1) / 2; i++) {
			stringArray[i] = byteToBigIntegerStr(msgContentByte, startIndex, endIndex);
			startIndex = endIndex;
			endIndex += Constants.VALUE_LEN;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getDialBackgroudPic(Str):" + s);
		}

		return stringArray;
	}

	/*
	 * String[0:]<开关> 0 - 关闭,1 - 开启 string[1]:<快捷回复总数> string[2]<长度1> string[3]:<回复文本1> ...<长度n><回复文本n> 快捷回复总数：不超过5条
	 * 回复文本: 使用Unicode编码，不超过20字符
	 */
	public static String[] getQuickMsgList(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getQuickMsgList(Str): ----- getQuickMsgList: null");
			return null;
		}

		int totalNum = HexToDecimal(msgContentByte[1]);
		String[] stringArray = new String[2 + totalNum * 2];
		stringArray[0] = String.valueOf(HexToDecimal(msgContentByte[0])); // switch
		stringArray[1] = String.valueOf(totalNum); // total num
		byte[] byteArray = new byte[msgContentByte.length - 2];
		System.arraycopy(msgContentByte, 2, byteArray, 0, msgContentByte.length - 2);
		int j = 2;
		for (int i = 0; i < byteArray.length; ) {
			Log.i(TAG, "getQuickMsgList(Str): ----- i=" + i);
			int length = HexToDecimal(byteArray[i]);
			Log.i(TAG, "getQuickMsgList(Str): -----length =" + length);
			stringArray[j] = Integer.toString(length);
			byte[] byteTmp = new byte[length];
			System.arraycopy(byteArray, i + 1, byteTmp, 0, length);
			stringArray[j + 1] = byteArrayToChar(byteTmp, StandardCharsets.UTF_8);
			// 下面两个函数得到结果都一样
			// stringArray[j+1] = new String(byteTmp, StandardCharsets.UTF_8);
			// stringArray[j+1] = bytesToSplicedString(byteTmp, 0,byteTmp.length);
			j += 2;
			i = i + 1 + length;
		}
		for (String s : stringArray) {
			Log.i(TAG, "getQuickMsgList(Str):" + s);
		}

		return stringArray;
	}

	/*
	 * string[0]: <开关> 开关: 0 - 关闭,1 - 开启 string[1]: <上次月经时间(4)> 上次月经时间: Unix时间戳 string[2]: <月经周期> 月经周期: 单位天 string[3]:
	 * <经期时长> 经期时长: 单位天 string[4]: <经期提醒-天> 经期提醒-天: 提醒的提前天数 string[5]: <经期提醒-分钟(2)> 经期提醒-分钟: 经期提醒当天的生效时间，是从00:00开始的分钟数
	 * string[6]: <排卵日提醒-天> 排卵期提醒-天: 提醒的提前天数 string[7]: <排卵日提醒-分钟(2)> 排卵期提醒-分钟: 排卵期提醒当天的生效时间，是从00:00开始的分钟数 string[8]:
	 * <提醒种类> 提醒种类: 0 - 不提醒, 1 - 经期排卵期都提醒, 2 - 只提醒经期, 3 - 只提醒排卵期 string[9]: <振动开关> 振动开关: 0 - 关闭, 1 - 开启
	 */
	public static String[] getFemaleHealthPara(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getQuickMsgList(Str): ----- getQuickMsgList: null");
			return null;
		}

		String[] stringArray = new String[10];
		stringArray[0] = String.valueOf(msgContentByte[0] & 0xFF); // switch, byte to DecimalString
		byte[] unixTime = new byte[4];
		System.arraycopy(msgContentByte, 1, unixTime, 0, 4);
		byte[] reversedBytes = reverseArray(unixTime);
		BigInteger bigInteger = new BigInteger(1, reversedBytes);
		long time = bigInteger.longValue();
		stringArray[1] = timeConversion(time); // menstrual date
		for (int i = 2; i < 5; i++) {
			stringArray[i] = String.valueOf(msgContentByte[i + 3] & 0xFF);// menstrual cycle,menstrual
			// duration,menstrual reminder date
		}
		/*
		 * StringBuilder menstrualReminderTime = new StringBuilder(2); for (int i = 0; i < 2 ; i++) {
		 * menstrualReminderTime.append(String.valueOf(msgContentByte[i+8] & 0xFF)); } stringArray[5] =
		 * menstrualReminderTime.toString();
		 */
		// menstrual reminder time

		stringArray[5] = byteToBigIntegerStr(msgContentByte, 8, 10);
		stringArray[6] = String.valueOf(msgContentByte[10] & 0xFF); // ovulation Reminder date

		/*
		 * StringBuilder ovulationReminderTime = new StringBuilder(2); for (int i = 0; i < 2 ; i++) {
		 * ovulationReminderTime.append(String.valueOf(msgContentByte[i+12] & 0xFF)); } stringArray[7] =
		 * ovulationReminderTime.toString();
		 */ // ovulation Reminder Time

		stringArray[7] = byteToBigIntegerStr(msgContentByte, 11, 13);
		stringArray[8] = String.valueOf(msgContentByte[13] & 0xFF); // reminder byte
		stringArray[9] = String.valueOf(msgContentByte[14] & 0xFF); // switch
		for (String s : stringArray) {
			Log.i(TAG, "getFemaleHealthControl(Str):" + s);
		}
		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setSedentaryAlartPara(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setSedentaryAlartPara(Str): ----- setSedentaryAlartPara: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setSedentaryAlartPara(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setMusicNoticeSwitch(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setMusicNodifySwitch(Str): ----- setMusicNodifySwitch: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setMusicNodifySwitch(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setMsgNodifySwitch(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setMsgNodifySwitch(Str): ----- setMsgNodifySwitch: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setMsgNodifySwitch(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] sendMsgNotifyContent(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "sendMsgNotifyContent(Str): ----- sendMsgNotifyContent: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "sendMsgNotifyContent(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setAlarm(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setAlarm(Str): ----- setAlarm: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setAlarm(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setDndMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setDndMode(Str): ----- setDndMode: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setDndMode(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] sendSingerName(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "sendSingerName(Str): ----- sendSingerName: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "sendSingerName(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] sendMusicName(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "sendMusicName(Str): ----- sendMusicName: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "sendMusicName(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] sendDialData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "sendDialData(Str): ----- sendDialData: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "sendDialData(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setCurrentDial(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setCurrentDial(Str): ----- setCurrentDial: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setCurrentDial(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0: busy 1: successful 2: false 3: not support
	 */
	public static String[] deleteDial(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "deleteDial(Str): ----- deleteDial: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "deleteDial(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setCompetitionInfoSwitch(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setCompetitionInfoSwitch(Str): ----- setCompetitionInfoSwitch: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setCompetitionInfoSwitch(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] syncCompetitionInfo(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "syncCompetitionInfo(Str): ----- syncCompetitionInfo: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "syncCompetitionInfo(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] syncWeatherInfo(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "syncWeatherInfo(Str): ----- syncWeatherInfo: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "syncWeatherInfo(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] sendPicData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "sendPicData(Str): ----- sendPicData: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "sendPicData(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] delPic(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "delPic(Str): ----- delPic: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "delPic(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setDialBackgroundPic(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setDialBackgroundPic(Str): ----- setDialBackgroundPic: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setDialBackgroundPic(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setQuickMsgList(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setQuickMsgList(Str): ----- setQuickMsgList: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setQuickMsgList(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setFemaleHealthPara(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setFemaleHealthPara(Str): ----- setFemaleHealthPara: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setFemaleHealthPara(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] customizeMsg(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "customizeMsg(Str): ----- customizeMsg: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "customizeMsg(Str): status :" + s);
		}

		return stringArray;
	}

	// no test ????
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] customizeReminder(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "customizeReminder(Str): ----- customizeReminder: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "customizeReminder(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] searchWatch(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "searchWatch(Str): ----- searchWatch: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "searchWatch(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] getVibratorLevel(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getViboratorLevel(Str): ----- getViboratorLevel: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getViboratorLevel(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setVibratorLevel(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setViboratorLevel(Str): ----- setViboratorLevel: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setViboratorLevel(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] getScreenOnTime(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getScreenOnTime(Str): ----- getScreenOnTime: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getScreenOnTime(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] userSelfExamModeSwitch(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "userSelfExamModeSwtitch(Str): ----- userSelfExamModeSwtitch: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "userSelfExamModeSwtitch(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] userSelfExamModeTest(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "userSelfExamModeTest(Str): ----- userSelfExamModeTest: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "userSelfExamModeTest(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] resetDevice(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "resetDevice(Str): ----- resetDevice: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "resetDevice(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] closeDevice(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "closeDevice(Str): ----- closeDevice: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "closeDevice(Str): status :" + s);
		}

		return stringArray;
	}

	/*
	 * String[0]:<status> 0:busy 1: successful 2: false 3:not support
	 */
	public static String[] setScreenOnTime(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setScreenOnTime(Str): ----- setScreenOnTime: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setScreenOnTime(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	// there is another receive info need to be added
	public static String[] setPowerSavingMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setPowerSavingMode(Str): ----- setPowerSavingMode: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setPowerSavingMode(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * string[0]<省电模式开关> string[1]<模式> string[2]<自动开启阈值> string[3]<省电模式状态> <省电模式状态>: 0: 未处于省电模式 1: 已处于省电模式
	 */
	public static String[] getPowerSavingMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getPowerSavingMode(Str): ----- getPowerSavingMode: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getPowerSavingMode(Str):" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * <status> 0:busy 1: successful 2: false 3:not support
	 */
	// there is another receive info need to be added
	public static String[] setMuteMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setMuteMode(Str): ----- setMuteMode: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setMuteMode(Str): status :" + s);
		}

		return stringArray;
	}

	// no test
	/*
	 * string[0]:<静音模式开关> string[1]:<振动开关>
	 */
	public static String[] getMuteMode(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "getMuteMode(Str): ----- getMuteMode: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "getMuteMode(Str): " + s);
		}

		return stringArray;
	}

	public static String[] setRouteBooksData(byte[] msgContentByte) {
		if (msgContentByte == null) {
			Log.i(TAG, "setRouteBooksData(Str): ----- setRouteBooksData: null");
			return null;
		}

		String[] stringArray = byteArrayToDecimalStringArray(msgContentByte);
		for (String s : stringArray) {
			Log.i(TAG, "setRouteBooksData(Str): routebooks_data :" + s);
		}

		return stringArray;
	}

	public String[] getMsgStr() {
		return msgStr;
	}

	public void setMsgStr(String[] str) {
		msgStr = new String[str.length];
		System.arraycopy(str, 0, msgStr, 0, str.length);
		msgStr = str;
	}

	public byte[] getMsgId() {
		return msgId;
	}

	public static void setMsgId(byte[] MsgId) {
		msgId = MsgId;
	}
}
